home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / swingall.jar / javax / swing / text / StringContent$RemoveUndo.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-07-15  |  1.6 KB  |  74 lines

  1. package javax.swing.text;
  2.  
  3. import java.util.Vector;
  4. import javax.swing.undo.AbstractUndoableEdit;
  5. import javax.swing.undo.CannotRedoException;
  6. import javax.swing.undo.CannotUndoException;
  7.  
  8. class StringContent$RemoveUndo extends AbstractUndoableEdit {
  9.    // $FF: synthetic field
  10.    private final StringContent this$0;
  11.    protected int offset;
  12.    protected int length;
  13.    protected String string;
  14.    protected Vector posRefs;
  15.  
  16.    protected StringContent$RemoveUndo(StringContent var1, int var2, String var3) {
  17.       this.this$0 = var1;
  18.       this.offset = var2;
  19.       this.string = var3;
  20.       this.length = var3.length();
  21.       if (var1.marks != null) {
  22.          this.posRefs = var1.getPositionsInRange((Vector)null, var2, this.length);
  23.       }
  24.  
  25.    }
  26.  
  27.    public void redo() throws CannotRedoException {
  28.       super.redo();
  29.  
  30.       try {
  31.          StringContent var1 = this.this$0;
  32.          synchronized(var1){}
  33.  
  34.          try {
  35.             this.string = this.this$0.getString(this.offset, this.length);
  36.             if (this.this$0.marks != null) {
  37.                this.posRefs = this.this$0.getPositionsInRange((Vector)null, this.offset, this.length);
  38.             }
  39.  
  40.             this.this$0.remove(this.offset, this.length);
  41.          } catch (Throwable var4) {
  42.             throw var4;
  43.          }
  44.  
  45.       } catch (BadLocationException var5) {
  46.          throw new CannotRedoException();
  47.       }
  48.    }
  49.  
  50.    public void undo() throws CannotUndoException {
  51.       super.undo();
  52.  
  53.       try {
  54.          StringContent var1 = this.this$0;
  55.          synchronized(var1){}
  56.  
  57.          try {
  58.             this.this$0.insertString(this.offset, this.string);
  59.             if (this.posRefs != null) {
  60.                this.this$0.updateUndoPositions(this.posRefs);
  61.                this.posRefs = null;
  62.             }
  63.  
  64.             this.string = null;
  65.          } catch (Throwable var4) {
  66.             throw var4;
  67.          }
  68.  
  69.       } catch (BadLocationException var5) {
  70.          throw new CannotUndoException();
  71.       }
  72.    }
  73. }
  74.